package pos.domain;

import com.google.gwt.core.client.GWT;

public class ManagerCrea {

	private ManagerCrea(TipoLinkU_P x) { link = x; }
	private TipoLinkU_P link;
	
	public TipoLinkU_P getLink() { return link; }
	
	public static void inserisci(TipoLinkU_P y) {
	   if (y != null && y.getPiano().quantiUtenti() == 0) {
	      ManagerCrea k = new ManagerCrea(y);
	      k.link.getPiano().inserisciPerManagerCrea(k);
	      k.link.getUtente().inserisciPerManagerCrea(k);
	      
	     }
	}
	
	public static void elimina(TipoLinkU_P y) {
	  try {
	    if (y != null && y.getPiano().getLinkCrea().equals(y) ) {
	       ManagerCrea k = new ManagerCrea(y);
	       k.link.getPiano().eliminaPerManagerCrea(k);
	       k.link.getUtente().eliminaPerManagerCrea(k);
	       
	  }
	}
	  catch (EccezioneCardMinMax e) {
	     System.out.println(e);
	}
  }
}
